#include <windows.h>
#include <detours.h>

#pragma comment(lib, "detours.lib")

#define EXPORT_API extern "C" __declspec(dllexport)

EXPORT_API void InjectDll()
{
	return;
}

static int(WINAPI *TrueMessageBox)(__in_opt  HWND hWnd,
										  __in_opt  LPCTSTR lpText,
										  __in_opt  LPCTSTR lpCaption,
										  __in      UINT uType) = MessageBox;

int WINAPI MyMessageBox(__in_opt  HWND hWnd, __in_opt  LPCTSTR lpText, __in_opt  LPCTSTR lpCaption,__in UINT uType)
{
	OutputDebugString("API Hooked!\n");
	int rv = 0;
	__try{
		rv = TrueMessageBox(hWnd, TEXT("Hooked!"), lpCaption, uType);
	}
	__finally{
		OutputDebugString("Call OrgMessageBox!\n");
	}
	return rv;
}